package com.yb.designpattern.produce;

public class Producer implements Runnable{
	private Storage<Phone> storage;
	public Producer(Storage<Phone> storage){
		this.storage = storage;
	}

	public void run(){
		for(int i=0;i<20;i++){
			storage.produce(new Phone(i));
			try {
				Thread.sleep(10);//每10毫秒生产一个产品
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}
